package com.jacky.iot.resources;

import org.eclipse.californium.core.CoapResource;
import org.eclipse.californium.core.Utils;
import org.eclipse.californium.core.coap.CoAP;
import org.eclipse.californium.core.coap.MediaTypeRegistry;
import org.eclipse.californium.core.coap.Request;
import org.eclipse.californium.core.server.resources.CoapExchange;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class LocationQueryResource extends CoapResource {
    private static final Logger log = LoggerFactory.getLogger(LocationQueryResource.class);

    public LocationQueryResource(String name) {
        super(name);
        getAttributes().setTitle("Perform POST transaction with responses containing several Location-Query options (CON mode)");
    }

    @Override
    public void handlePOST(CoapExchange exchange) {
        exchange.setLocationQuery("?first=1&second=2");
        exchange.respond(CoAP.ResponseCode.CREATED);
    }
}
